<template>
  <view class="tabbar">
    <u-tabbar
      :value="current"
      @change="change"
      :fixed="true"
      :placeholder="true"
      :safeAreaInsetBottom="true"
      active-color="green"
    >
      <u-tabbar-item
        v-for="(item, index) in list"
        :key="index"
        :text="item.text"
        :icon="item.icon"
        @click="routerTo(item)"
      ></u-tabbar-item>
    </u-tabbar>
  </view>
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
  import { constDataConfig } from '@/config/constData.config';
  export default defineComponent({
    name: 'Tabbar',
    props: {
      current: {
        type: Number,

        default: 0,
      },
    },
    setup() {
      const { tabbarList } = constDataConfig;
      const list = tabbarList.tabBar;
      function change() {}
      function routerTo(item) {
        uni.switchTab({
          url: item.pagePath,
        });
      }
      return {
        list,
        change,
        routerTo,
      };
    },
  });
</script>
